home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 3.4 KB | 99 lines | [TEXT/MPS ] |
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n+]}
- { UBetterFeedbackCmd.p }
- { Copyright © 1988-1990 by Apple Computer, Inc. All rights reserved.}
-
- {[f-]}
- { This unit attempts to provide smooth flicker-free feedback during command tracking.
-
- T H E O R Y O F O P E R A T I O N
-
- By synchronizing drawing to the vertical retrace interrupt, this unit attempts
- to improve the feedback that mouse trackers provide.
-
- Ideally, this behavior would be part of MacApp's TApplication.TrackMouse method.
- What TApplication.TrackMouse should really do is:
- a) wait for the vertical retrace interrupt of the device that the view most intersects
- b) erase the old tracker feedback by calling tracker.TrackFeedback(…, turn It Off, …)
- c) immediately draw the new feedback by calling tracker.TrackFeedback(…, turn It on, …)
-
- However, with the current architecture, this is impossible. TApplication.TrackMouse currently
- does the following:
- a) call tracker.TrackFeedback(…, turn It Off, …) to erase the previous tracker feedback
- b) call tracker.TrackMouse(trackMove, …) to tell the tracker the track phase
- c) call tracker.TrackFeedback(…, turn It On, …) to draw the new tracker feedback
-
- UBetterFeedbackCmd provides a way to work within the current architecture to provide a close
- attempt at smooth flicker-free feedback. To take advantage of this unit, create a
- subclass of TBetterFeedbackCmd. Then, OVERRIDE PROCEDURE TBetterFeedbackCmd.TrackFeedback()
- and as the first statement of this method call:
- INHERITED TrackFeedback(anchorPoint, nextPoint, turnItOn, mouseDidMove);
- so that TBetterFeedbackCmd.TrackFeedback can synch to the vertical retrace interrupt.
- Then the tracker should go ahead and draw/erase the feedback.
-
- For an example, see DrawShapes: TShapeSketcher, TShapeDragger, and TShapeSelector.
-
- }
- {[f+]}
-
- UNIT UBetterFeedbackCmd;
-
- INTERFACE
-
- USES
- { • MacApp }
- UMacApp,
-
- { • Building Blocks }
-
- { • Required for this unit's interface }
-
- { • Implementation Use }
- Start, Retrace;
-
- CONST
-
- kInstall = TRUE; { pass to BetterFeedback:
- install our VBL? }
- kBetterFeedbackDesired = TRUE; { pass to IBetterFeedbackCmd:
- desire better feedback? }
-
- TYPE
- TBetterFeedbackCmd = OBJECT (TCommand)
-
- fBetterFeedbackInstalled: BOOLEAN; { are the synchronization routines in? }
-
- fBetterFeedbackDesired: BOOLEAN; { want the synchronization routines? }
-
- PROCEDURE TBetterFeedbackCmd.IBetterFeedbackCmd(itsCmdNumber: CmdNumber;
- itsDocument: TDocument; itsView: TView;
- itsScroller: TScroller;
- betterFeedbackDesired: BOOLEAN);
-
- PROCEDURE TBetterFeedbackCmd.Free; OVERRIDE;
-
- { for tracking }
- PROCEDURE TBetterFeedbackCmd.BetterFeedback(install: BOOLEAN);
-
- PROCEDURE TBetterFeedbackCmd.WaitBetterFeedback;
-
- FUNCTION TBetterFeedbackCmd.TrackMouse(aTrackPhase: TrackPhase; VAR anchorPoint,
- previousPoint, nextPoint: VPoint;
- mouseDidMove: Boolean): TCommand; OVERRIDE;
-
- PROCEDURE TBetterFeedbackCmd.TrackFeedback(anchorPoint, nextPoint: VPoint; turnItOn,
- mouseDidMove: Boolean); OVERRIDE;
-
- { Inspecting }
-
- PROCEDURE TBetterFeedbackCmd.Fields(PROCEDURE
- DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- END;
-
- IMPLEMENTATION
-
- {$I UBetterFeedbackCmd.inc1.p}
-
- END.
-